<?php

/**
 * Product type price model
 *
 * @category    Mage
 * @package     Mage_Catalog
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Xzsdsplus_Configurableplus_Model_Product_Type_Price extends Mage_Catalog_Model_Product_Type_Price {
    
    /**
     * Apply options price
     *
     * @param Mage_Catalog_Model_Product $product
     * @param int $qty
     * @param double $finalPrice
     * @return double
     */
    protected function _applyOptionsPrice($product, $qty, $finalPrice)
    {
        if ($optionIds = $product->getCustomOption('option_ids')) {
            $basePrice = $finalPrice;
            foreach (explode(',', $optionIds->getValue()) as $optionId) {
                if ($option = $product->getOptionById($optionId)) {

                    $confItemOption = $product->getCustomOption('option_'.$option->getId());
                    $group = $option->groupFactory($option->getType())
                        ->setOption($option)
                        ->setConfigurationItemOption($confItemOption);

                    //$finalPrice += $group->getOptionPrice($confItemOption->getValue(), $basePrice);
                    $finalPrice += $group->getOptionPrice($confItemOption->getValue(),  $finalPrice);
                }
            }
        }

        return $finalPrice;
    }

}
